home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 167 / pascal / timestuf.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1987-08-19  |  1.9 KB  |  61 lines

  1. FUNCTION t_getdate : Integer ;
  2.   GEMDOS( $2a ) ;
  3.  
  4. FUNCTION t_setdate( date : Integer ) : Integer ;
  5.   GEMDOS( $2b ) ;
  6.  
  7. FUNCTION t_gettime : Integer ;
  8.   GEMDOS( $2c ) ;
  9.  
  10. FUNCTION t_settime( time : integer ) : integer ;
  11.   GEMDOS( $2d ) ;
  12.  
  13.  
  14. FUNCTION Super( x: long_integer ) : long_integer;
  15.    Gemdos( $20 );
  16.  
  17. FUNCTION Ticks : Long_integer; { System timer 200/second resolution }
  18. TYPE
  19.    Long_pointer = ^long_integer;
  20. VAR
  21.    SSP : Long_Integer;        { save old supervisor stack pointer }
  22.    hz_200 : RECORD
  23.       CASE Boolean OF
  24.          true : ( l: long_integer );
  25.          false : ( p: long_pointer );
  26.       END;
  27. BEGIN
  28.    SSP := Super( 0 );        { save supervisor stack.. enter super mode }
  29.    hz_200.l := $4ba;         { point at 200 hertz timer }
  30.    {$p-}                     { turn pointer checking off }
  31.    Ticks := hz_200.p^;        { get the longword at that location }
  32.    {$p=}                     { restore old value of pointer checking }
  33.    SSP := Super( SSP );      { restore supervisor stack... enter user mode }
  34. END;  { of Ticks }
  35.  
  36. PROCEDURE Event_Loop ;
  37. VAR
  38.    which,
  39.    dummy,
  40.    key_state, W_key,
  41.    x, y : integer ;
  42.    msg : Message_Buffer ;
  43. BEGIN
  44.    REPEAT
  45.      { Get a mouse button event. }
  46.      which := Get_Event( E_Timer | E_Button, $0001, 0, 0,
  47.               0, { time count of zero - quik return }
  48.               false, 0, 0, 0, 0, false, 0, 0, 0, 0, { no rect's }
  49.               msg, W_Key,   { what key }
  50.               dummy, dummy, x, y, key_state ) ;
  51.    UNTIL which>33;
  52.    REPEAT
  53.      { Get a mouse button event. }
  54.      which := Get_Event( E_Timer | E_Button, $0001, 0, 0,
  55.               0, { time count of zero - quik return }
  56.               false, 0, 0, 0, 0, false, 0, 0, 0, 0, { no rect's }
  57.               msg, W_Key,   { what key }
  58.               dummy, dummy, x, y, key_state ) ;
  59.    UNTIL which<34;
  60. END ;  { of Event_Loop }
  61.